/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 刘远望
 * Date: 2025-03-12
 * Time: 22:40
 */
class Date{
    public Date(int year, int month , int day){
        this.year = year;
        this.month = month;
        this.day = day;
        System.out.println("带参数初始化三个");
    }
    public Date(){
        //this.year = 2025;
        this(2025, 3,12);
        System.out.println("不带参数");
    }
    public int year;
    public int month;
    public int day;
    /*public void setDate(int y , int m ,int d){
        year = y;
        month = m;
        day = d;
    }*/
    /*public void setDate(int year , int month ,int day){
        //局部变量优先使用 不会改变成员变量
        year = year;
        month = month;
        day = day;
    }*/
    public void setDate(int year , int month ,int day){
        //this改变
        this.year = year;
        this.month = month;
        this.day = day;
    }
    /*public void setDate(Date this ,int y , int m ,int d){
        year = y;
        month = m;
        day = d;
    }*/
    public void printDate(){
        System.out.println(year + " 年 " + month + " 月 " + day + " 日 ");
    }
}
public class Test2 {
    public static void main(String[] args) {
        Date date = new Date();
        date.setDate(2025, 3, 12);
        date.printDate();
        System.out.println(date.year + " 年 " + date.month + " 月 " + date.day + " 日 ");
        //构造方法(初始化成员变量)

    }
}
